package apiwork.lcbmi.validators;

import com.opensymphony.xwork2.validator.validators.RegexFieldValidator;


/**
 * <!-- START SNIPPET: javadoc -->
 * CustomerNameValidator checks that a given String field, if empty or is a valid cusotmername.
 * <p/>
 * <p/>
 * The regular expression used to validate that the string is a cusotmername
 * is:
 * </p>
 * <pre>
 * [_a-z0-9-\.]{1,40}
 * </pre>
 * <!-- END SNIPPET: javadoc -->
 * 
 * 
 * <!-- START SNIPPET: parameters -->
 * <ul>
 * 		<li>fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required</li>
 * </ul>
 * <!-- END SNIPPET: parameters -->
 * 
 * 
 * <pre>
 * <!-- START SNIPPET: example -->
 *     &lt;!-- Plain Validator Syntax --&gt;
 *     &lt;validators&gt;
 *         &lt;validator type="customerName"&gt;
 *             &lt;param name="fieldName"&gt;customername&lt;/param&gt;
 *             &lt;message&gt;Must provide a valid customername&lt;/message&gt;
 *         &lt;/validator&gt;
 *     &lt;/validators&gt;
 *     
 *     &lt;!-- Field Validator Syntax --&gt;
 *     &lt;field name="customername"&gt;
 *        &lt;field-validator type="customerName"&gt;
 *           &lt;message&gt;Must provide a valid customername&lt;/message&gt;
 *        &lt;/field-validator&gt;
 *     &lt;/field&gt;
 * <!-- END SNIPPET: example -->
 * </pre>
 *
 * @author lance
 */
public class CustomerNameFieldValidator extends RegexFieldValidator {

	// see XW-371 
    public static final String customerNamePattern =
    	"[_a-z0-9-\\.]{1,40}";

    public CustomerNameFieldValidator() {
        setExpression(customerNamePattern);
        setCaseSensitive(false);
    }

}


